#include "insert_sort.h"

using namespace std;

void insert_sort(int* array, size_t len)
{
    for ( size_t i = 1; i < len; ++i )
    {
        int key = array[i];
        int j = i - 1;

        while ( j >= 0 && array[j] > key )
        {
            array[j + 1] = array[j];
            --j;
        }
        array[j + 1] = key;
    }
}

